'use strict';

const Controller = require('egg').Controller;

class UploadController extends Controller {
  async getQiniuToken() {
    const { ctx } = this;
    const token = await ctx.service.qiniu.getQiniuToken();
    ctx.returnBody(200, '获取Token成功', {
      token,
      baseUrl: 'http://qiniu.fengweio.com',
    });
  }

  async handlePosts() {
    const { ctx } = this;
    const file = ctx.request.body;

    console.log(file);

    ctx.returnBody(200, '上传成功', {});
  }
}

module.exports = UploadController;
